package datasource;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.beans.PropertyVetoException;

public class C3P0Utils {
    public static ComboPooledDataSource cpds=null;
    static {
        cpds = new ComboPooledDataSource();
        try {
            cpds.setDriverClass("com.mysql.jdbc.Driver");
            cpds.setJdbcUrl("jdbc:mysql://localhost:3307/jdbc");
            cpds.setUser("root");
            cpds.setPassword("123456");

            cpds.setInitialPoolSize(5);
            cpds.setMaxPoolSize(15);
        } catch (PropertyVetoException e) {
            e.printStackTrace();
        }
    }
    public static ComboPooledDataSource getConnection(){
            return cpds;
    }
}

